# def my_power():
#     n = 2
#
#     def power(x):
#         nonlocal n
#         n += 1
#         return x ** n
#
#     return power
#
#
# p = my_power()
# print(p(3))
# print(p.__closure__)
#

def my_power():
    n = 2
    L = []
    for i in range(1, 3):
        def power():
            return i ** n

        L.append(power)
    return L


f1, f2 = my_power()
print(f1())
print(f2())
print('-----------------')
print(f1.__closure__[0].cell_contents)
print(f1.__closure__[1].cell_contents)
print(f2.__closure__[0].cell_contents)
print(f2.__closure__[1].cell_contents)
